#include<iostream>
#include<cmath>
using namespace std;
typedef long long LL;
LL n,a,b;
int main()
{
	int t;
	scanf("%d",&t);
	while(t--){
		scanf("%lld%lld%lld",&n,&a,&b);
		if(!n){
			printf("0\n");
			continue;
		}
		LL z=n;
		LL cnt=0;
		LL temp=n;
		while(n!=1){
			cnt++;
			LL x1=(n+a)/2;
			LL x2=(LL)sqrt(n + b);
			//cout<<"x1=="<<x1<<endl;
			//cout<<"x2=="<<x2<<endl;
			n=min(x1,x2);
			if(temp<=n){
				cnt--;
				break;
			}
			temp=n;
			//cout<<"n=="<<n<<endl;
			//cout<<"cnt=="<<cnt<<endl;
		} 
		LL ans=min(cnt+n,z);
		printf("%lld\n",ans);
//		cout<<"n==="<<n<<endl;
//		cnt+=log2(n);
//		cout<<cnt+1<<endl;
	}
	return 0;
} 
